package com.hcd.weixin.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hcd.weixin.domain.Pile;
import com.hcd.weixin.mapper.VendingMachineMapper;
import com.hcd.weixin.service.ChannelService;
import com.hcd.weixin.service.VendingMachineService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class VendingMachineServiceImpl extends ServiceImpl<VendingMachineMapper, Pile> implements VendingMachineService {

    @Autowired
    private ChannelService channelService;

    // 更改售货机状态
    public boolean updateStatus(String pileSn, Integer deployStatus) {
        UpdateWrapper<Pile> uw = new UpdateWrapper<>();
        uw.lambda()
                .eq(Pile::getPileSn, pileSn)
                .set(Pile::getDeployStatus, deployStatus);
        return this.update(uw);
    }

}
